import {Injectable} from '@angular/core';
import {HttpService} from '../../../../core/http.service';
import {CommHttpService} from '../../../../core/comm.http.service';
import {SERVERS_NAME} from '../../../../config/config';
import {Observable} from 'rxjs';

@Injectable()
export class StudentEvaluteformService extends CommHttpService {
    protected preUrl = `${SERVERS_NAME.EVALUTE_SERVER}evalute/studentPaper/`;

    constructor(protected http: HttpService) {
        super(http);
    }

    /**********接口部分**********/

    /**
     * 预览
     * @param param： param
     */
    buildExam(param): Observable<any> {
        return this.http.post(param, this.preUrl + `buildExam`);
    }

    /**
     * 导入Excel
     *
     * @returns Observable<any>返回值
     * @param data: 数据参数
     */
    importExcel(data: any): Observable<any> {
        return this.http.postFile(data, `${SERVERS_NAME.SAFETY_EDU}` + 'safety/edu/question/import');
    }

  /**
   * 查询试题分类树
   */
  getQuesTree(): Observable<any> {
    return this.http.post({}, `${SERVERS_NAME.EVALUTE_SERVER}base/questionClassify/tree`);
  }

  /**
   * 统计分类下题目数量
   */
  getCountItem(data): Observable<any> {
    return this.http.post(data, `${SERVERS_NAME.EVALUTE_SERVER}base/questionClassify/countItem`);
  }

  /**
   * 查询试题分页
   */
  pageSubjectList(data): Observable<any> {
    return this.http.post(data, `${SERVERS_NAME.EVALUTE_SERVER}base/questionItem/page`);
  }

  /**
   * 查询试题-根据id
   */
  getSubjectList(data): Observable<any> {
    return this.http.post(data, `${SERVERS_NAME.EVALUTE_SERVER}base/questionItem/findAll`);
  }

}
